import { MoveRocker, AttackRocker, SkillRocker } from "./Rocker";

export default class GamePanel extends Laya.Sprite {

    static getInstance() {
        if (!this.instance||this.instance.destroyed) this.instance = new this();
        return this.instance;
    }

    constructor() {
        super();
        this.init();
    }

    init() {
        this.resizable(()=> {
            this.height = Laya.stage.height;
            this.width = Laya.stage.width;
        });

        this.moveRocker = MoveRocker.getInstance();
        this.moveRocker.pos(186, 585);
        this.addChild(this.moveRocker);
        
        this.attackRocker = AttackRocker.getInstance();
        this.attackRocker.pos(1300, 585);
        this.addChild(this.attackRocker);

        this.skillRocker = SkillRocker.getInstance();
        this.skillRocker.pos(1070, 624);
        this.addChild(this.skillRocker);
        
        this.initCompents();
    }

    initCompents() {
        this.battleInfo = new ui.Room.Com.BattleInfoUI();
        this.battleInfo.x = (Laya.stage.width - 184)/2;
        this.addChild(this.battleInfo);
        
        this.gameStatusInfo = new ui.Room.Com.GameStatusInfoUI();
        this.gameStatusInfo.x = Laya.stage.width;
        this.addChild(this.gameStatusInfo);

    }

}